Skip to content

adopt: validate DSL output against the engine's imposter JSON Schema (sdk-conformance schema/imposter.schema.json) - #314

Merged
EtaCassiopeia merged 1 commit into
masterfrom
test/rift-300-imposter-schema-validation
Oct 16, 2026
Merged

EtaCassiopeia merged 1 commit into
masterfrom
test/rift-300-imposter-schema-validation

Conversation

@EtaCassiopeia

Copy link
Copy Markdown
Collaborator

rift 0.22.0 ships the engine's imposter grammar as a JSON Schema (draft 2020-12) inside the sdk-conformance tarball, at schema/imposter.schema.json (rift#1342). Every object in it is closed (additionalProperties: false) except the provider maps. A document that validates therefore carries no key the engine never reads.

Changes

  • New SchemaConformanceTest, the conformance module's "Schema" gate:
    • dslOutputValidates: every DSL-built fixture validates against the schema.
    • codecOutputValidates: every fixture's fromJson → toJson output validates. A parse failure outside KnownFidelityGaps is rethrown.
    • modeledKeysAreKeysTheEngineReads: each of the 7 model types' MODELED_KEYS must be a subset of its $defs properties. The keys are read reflectively.
    • predicateParametersAreExactlyTheSchemasNonOperatorKeys: checks PredicateOperation.RESERVED_KEYS in both directions.
    • theValidatorRejectsAKeyTheEngineNeverReads: negative cases (an unread stub key, an unread _rift key reached through $ref, a mistyped statusCode), so a no-op validator cannot pass.
  • Corpus.schema(): finds the schema by file presence. A corpus without it skips the gate. The RIFT_IT=1 lane fails instead when a 0.22.0+ corpus lacks it.
  • Test-scope dependency com.networknt:json-schema-validator 1.5.6. It lives in the conformance module, which is not deployed, so core stays dependency-free. Jackson is aligned by the root BOM.
  • The conformance README documents the gate.

The issue asked to "derive MODELED_KEYS from $defs". Core doesn't ship the schema, so deriving the keys at runtime isn't possible. Instead, the hand-kept lists are checked against the schema on every conformance run.

Verification

  • ./mvnw -B verify -Drift.corpus.root=<0.22.0 corpus>: green. SchemaConformanceTest ran 33 tests (2 aborted: fixtures with no DSL builder, or a known fidelity gap).
  • Without a corpus, all 3 test containers skip.
  • Mutation checks, each reverted afterwards:
    • re-adding backend to RiftFlowStateConfig.MODELED_KEYS → modeledKeysAreKeysTheEngineReads fails with {RiftFlowStateConfig=[backend]};
    • making Stub emit an unread key → 29 failures, each naming property 'nmae' is not defined in the schema.

Closes #300

🤖 Generated with Claude Code

…JSON Schema

rift 0.22.0 ships the imposter grammar as a closed draft 2020-12 schema in
the sdk-conformance tarball (rift#1342). SchemaConformanceTest validates what
the DSL builds and what the codec writes back for every fixture, and checks
each model's hand-kept MODELED_KEYS and the predicate parameter set against
the schema's $defs, so those lists can no longer drift from the engine the
way flowState.backend and keyCaseSensitive did.

A corpus without schema/ skips the gate; the RIFT_IT lane fails instead when
a 0.22.0+ corpus lacks it. The validator (networknt json-schema-validator) is
test-scope in the unpublished conformance module.

Closes #300
@EtaCassiopeia
EtaCassiopeia merged commit 8fa4e41 into master Oct 16, 2026
16 checks passed
@EtaCassiopeia
EtaCassiopeia deleted the test/rift-300-imposter-schema-validation branch October 16, 2026 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

adopt: validate DSL output against the engine's imposter JSON Schema (sdk-conformance schema/imposter.schema.json)

1 participant